package com.learning.spring.cloud.api;

import com.learning.spring.cloud.domain.service.ProductInventoryService;
import com.learning.spring.cloud.dto.ProductInventoryDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/inventory")
public class InventoryController {
    @Autowired
    private ProductInventoryService productInventoryService;

    @GetMapping(path = "/find/{productCode}")
    public ProductInventoryDto find(@PathVariable String productCode) {
        return productInventoryService.findByProduct(productCode);
    }
}
